<template>
  <a-space direction="vertical" style="width: 100%">
    <a-card title="收款查询">
      <a-form :model="queryParams" layout="inline">
        <a-form-item label="选择客户">
          <CustomerSelection :preload="true" @customerSelected="customerSelected" ref="csRef" />
        </a-form-item>
        <a-form-item label="日期选择">
          <a-range-picker v-model:value="queryParams.occurredRange" valueFormat="yyyy-MM-DD"/>
        </a-form-item>
       
        <a-form-item>
          <a-button type="primary" html-type="submit" @click="query">查询</a-button>
        </a-form-item>
        <a-form-item>
          <a-button @click="reset">重置</a-button>
        </a-form-item>
      </a-form>
    </a-card>
    <!--      <a-divider style="border-color: #7cb305" dashed />-->
    <a-card title="查询结果">
      <a-table
        :columns="columns"
        :data-source="receiptDataSet"
        rowKey="uid"
        :pagination="paginationConfig"
      >
        <template #action="{ record }">
          <a-button type="link" @click="showAr(record.uid)">显示核销的应收款</a-button>
        </template>
        <template #enabled="{ record }">
          <span v-if="record.enabled">启用</span>
          <span v-else>停用</span>
        </template>
      </a-table>
    </a-card>
  </a-space>
</template>

<script lang="ts" setup>
import { useReceiptListFunctions } from './receiptListFunctions'
import CustomerSelection from '@/components/chunfeng/customer/CustomerSelection.vue'

const { paginationConfig, queryParams, columns, reset, query, receiptDataSet, customerSelected,csRef,showAr } =
  useReceiptListFunctions()
</script>
